package com.sharkburner.aeris.service.source;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.sharkburner.aeris.dao.ISiteDao;
import com.sharkburner.aeris.dao.entity.Site;
import com.sharkburner.aeris.ui.module.site.bean.SourceBean;

/**
 * @author ArtyomyuS
 * 
 */
@Service
public class SourceService {
	@Autowired
	private ISiteDao siteDao;

	/**
	 * @return
	 */
	public List<Site> findSources() {
		return siteDao.getAll();
	}

	@Transactional
	public void save(SourceBean bean) {
		try{
			Site site = new Site();
			site.setName(bean.getName());
			siteDao.saveOrUpdate(site);
		}catch(Exception e){
			e.printStackTrace();
		}
	}
}
